package panels;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import utils.imageButton;

public class TopBar extends JPanel {
	private JButton day,week,month;
	public TopBar(){
		setLayout(new GridLayout(1,2));
		//Container top = getContentPane();
		//top.add(arg0, arg1)
		JPanel buttonPanel = new JPanel();
		buttonPanel.setBackground(Color.white);
		this.setPreferredSize(new Dimension(500,60));
		JPanel datePanel = new JPanel();
		datePanel.setBackground(Color.white);
		datePanel.setLayout(new BorderLayout());
		JLabel timeLabel = new JLabel();
		Calendar calendar = Calendar.getInstance();
		SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy");
		timeLabel.setText(format.format(calendar.getTime()));
		timeLabel.setFont(new Font("Arial", Font.BOLD, 16));
	    datePanel.add(timeLabel,BorderLayout.CENTER);
	    datePanel.setAlignmentX(CENTER_ALIGNMENT);
	    add(datePanel);
		
		//buttons.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
		day=new imageButton("img/day.jpg",44,44);
		week = new imageButton("img/week.jpg",44,44);
		month = new imageButton("img/month.jpg",44,44);
		
		JPanel buttons = new JPanel();
		buttons.setBackground(Color.white);
		buttons.add(day);
		buttons.add(week);
		buttons.add(month);
		buttons.setPreferredSize(new Dimension(150,80));
		buttonPanel.add(buttons,BorderLayout.CENTER);
		add(buttonPanel);
		this.setBackground(Color.white);
		
	}
}
